var t = require;
var e = module;
var o = exports;
Object.defineProperty(o, "__esModule", {value: !0});
var a = t("GameEm"),
    i = new ((function () {
        function t() {
            this.G_Mat = null;
            this.W_Mat = null;
            this.screanSize = cc.v2(750, 1334);
            this.screanWposCenter = cc.v2(0, 0);
            this.screanWpos = cc.Vec2.ZERO;
            this.debugAd = !0;
            this.viewRuleId = ["4021", "4041", "4061", "", "4081", "4101", "4121", "4141", "4161", "4181", "4201"];
            this.isUpdateRed = !1;
            this.uplevelToFra = !1;
            this.mapIsLoadOver = !1;
            this.addMulTime = 3e5;
            this.addWanMeiTime = 5;
            this.addMulTimeCd = 3e5;
            this.invateTimeCd = 18e5;
            this.invateMakeTime = 3e5;
            this.teMaiTime = 3e5;
            this.teMaiCdTime = 6e5;
            this.shopCof = {};
            this.gameLastTime = 0;
            this.cacheTime = {};
            this.selfCatId = "";
            this.isLoadingCof = !1;
            this._updataCost = !1;
            this.updateEquip = !1;
            this.allLevelData = {};
            this.starCount = {};
            this.foodLvToStarIndex = {};
            this.foodCdData = {};
            this.redData = {};
            this.allEquipAttion = {};
            this.foodTabHaveData = {};
            this.foodDevData = {};
            this.adMul = 1;
            this.cacheIndex = {};
            this.reduceCount = 0;
            this.foodObj = {};
            this.curAddSpeedsPro = {};
            this.invateIdData = {};
            this.invateAllCof = {};
            this.debugMoveSpeeds = 1;
            this.starItemCount = {};
            this.foodLevelData = {};
            this.limiteCount = "00000000";
            this.checkList = [];
            this.curGameCount = "0";
            this.taskOverIndex = {};
            this.canUpLevelNextRooms = !1;
            this.canSave = !1;
            this.isUpdateNextSave = !1;
            this.canCheckAllMinCs = !1;
            this.devUnLockData = {};
            this.equipActive = {};
            this.isViewAdBtn = !1;
            this.canMerageData = !1;
            this.flowerCatMove = null;
            this.dlgPos = cc.Vec2.ZERO;
            this.taskCost = null;
            this.checkIdToFoodId = {};
            this.foodTabCount = {};
            this.isUpdateWear = !1;
            this.qualityCenterChange = 4;
            this.objRule = {};
            this.levelBaseData = {};
            this.allTempData = null;
            this.cacheUpgrade = null;
            this.objTypeLevelAddData = {};
            this.levelUpgradeData = {};
            this.roomRestaurant = {};
            this.levelNpcMoveAren = {};
            this.levelRoadMoveAren = {};
            this.levelRoadPath = {};
            this.timeObj = {};
            this.invateData = null;
        }
        t.prototype.boxLimitePos = function (t, e) {
            var o = this.screanSize.x / 2,
                a = this.screanSize.y / 2;
            t.x = Math.max(-o + e, t.x);
            t.x = Math.min(o - e, t.x);
            t.y = Math.max(-a + e, t.y);
            t.y = Math.min(a - e, t.y);
            return t;
        };
        t.prototype.setShopData = function (t) {
            this.shopCof = t;
        };
        t.prototype.getShopDataCof = function () {
            return this.shopCof;
        };
        t.prototype.setLastAdViewGameTime = function (t, e) {
            this.cacheTime[t] = e;
        };
        t.prototype.getLastAdViewGameTime = function (t) {
            return this.cacheTime[t] || 0;
        };
        t.prototype.setSpriteMat = function (t, e) {
            t.setMaterial(0, e ? this.W_Mat : this.G_Mat);
        };
        t.prototype.delayTime = function (t, e) {
            setTimeout(e, t);
        };
        t.prototype.canMerage = function () {
            var t = GameDataValue.getAllSelfEquip(),
                e = {},
                o = {},
                a = this.getCostumeup(),
                i = this.getCostume();
            for (var n in t) {
                var r = t[n].id;
                e[r] || (e[r] = 0);
                var s = i[a[r].costume_id],
                    c = a[r].quality + "_" + s.type;
                o[c] || (o[c] = 0);
                o[c]++;
                e[r]++;
            }
            var p = !1;
            for (var n in a)
                if (a[n].up_costume) {
                    p = !0;
                    for (
                        var l = (a[n].up_costume + "").split("|"),
                            d = ParseTool.getSplit(a[n].up_quality, "|"),
                            u = (i[a[n].costume_id].type, {}),
                            h = 0;
                        h < l.length;
                        h++
                    ) {
                        var f = l[h];
                        u[f] || (u[f] = 0);
                        u[f]++;
                    }
                    for (var y in u) {
                        if (!e[y]) {
                            p = !1;
                            break;
                        }
                        if (e[y] < (u[y] || 0)) {
                            if (d.length > 0) {
                                for (var v = 0; v < d.length; v++)
                                    if (o[d[v]] < 1) {
                                        p = !1;
                                        break;
                                    }
                            } else p = !1;
                            break;
                        }
                    }
                    if (d.length > 0 && p)
                        for (var g = i[a[n].costume_id], m = 0; m < d.length; m++)
                            if ((o[d[m] + "_" + g.type] || 0) < d.length + 1) {
                                p = !1;
                                break;
                            }
                    if (p) return !0;
                }
            return !1;
        };
        t.prototype.getMerageObj = function () {
            var t = {},
                e = GameDataValue.getAllSelfEquip(),
                o = {},
                a = {},
                i = this.getCostumeup(),
                n = this.getCostume();
            for (var r in e) {
                var s = e[r].id;
                o[s] || (o[s] = 0);
                var c = n[i[s].costume_id];
                a[(b = i[s].quality + "_" + c.type)] || (a[b] = 0);
                a[b]++;
                o[s]++;
            }
            var p = !1;
            for (var r in i)
                if (i[r].up_costume) {
                    p = !0;
                    for (
                        var l = (i[r].up_costume + "").split("|"),
                            d = ParseTool.getSplit(i[r].up_quality, "|"),
                            u = n[i[r].costume_id].type,
                            h = {},
                            f = 0;
                        f < l.length;
                        f++
                    ) {
                        var y = l[f];
                        h[y] || (h[y] = 0);
                        h[y]++;
                    }
                    for (var v in h) {
                        if (!o[v]) {
                            p = !1;
                            break;
                        }
                        if (o[v] < (h[v] || 0)) {
                            if (d.length > 0) {
                                for (var g = 0; g < d.length; g++)
                                    if (a[d[g]] < 1) {
                                        p = !1;
                                        break;
                                    }
                            } else p = !1;
                            break;
                        }
                    }
                    if (d.length > 0 && p) {
                        for (var m = n[i[r].costume_id], _ = 0; _ < d.length; _++)
                            if ((a[d[_] + "_" + m.type] || 0) < d.length + 1) {
                                p = !1;
                                break;
                            }
                        if (p)
                            for (var C in e) {
                                var b = i[(w = e[C].id)].quality + "",
                                    I = n[i[w].costume_id].type;
                                d.indexOf(b) >= 0 && I == u && (t[w] = !0);
                            }
                    }
                    if (p) for (var w in h) t[w] = !0;
                }
            return t;
        };
        Object.defineProperty(t.prototype, "updateCostDataView", {
            get: function () {
                return this._updataCost;
            },
            set: function (t) {
                this._updataCost = t;
            },
            enumerable: !1,
            configurable: !0
        });
        t.prototype.getAdMul = function () {
            return this.adMul;
        };
        t.prototype.getAllPayCount = function () {
            return PayData.getMulAdd2Pro() * PayData.getMulAdd5Pro() * PayData.getProMul();
        };
        t.prototype.setFoodTab = function (t, e) {
            this.foodTabHaveData[t] = e;
        };
        t.prototype.getFoodTabStatus = function (t) {
            return this.foodTabHaveData[t];
        };
        t.prototype.setGameDirCache = function (t, e) {
            console.log("CacheDataManager ---------------方向数据-- ", t);
            this.reduceCount = e;
            this.cacheIndex = t;
        };
        t.prototype.getCacheDirIndex = function (t) {
            var e = t - this.reduceCount;
            return this.cacheIndex[e] || "1";
        };
        t.prototype.getCatMoveSpeeds = function (t) {
            return this.getAddtionValue(t, a.AddtionData.allMoveSpeedsAdd);
        };
        t.prototype.isImMakeFood = function (t, e) {
            return Math.random() < this.getImMakeFoodCount(t, e);
        };
        t.prototype.getImMakeFoodCount = function (t, e) {
            return (
                this.getAddAllAddtion(a.AddtionData.imOverFoodAdd) +
                this.getAddCatAddtion(t, e, a.AddtionData.imOverFoodAdd)
            );
        };
        t.prototype.isPerfectRateAdd = function (t, e) {
            return Math.random() < this.getImPerfectCount(t, e);
        };
        t.prototype.getImPerfectCount = function (t, e) {
            return (
                this.getAddAllAddtion(a.AddtionData.perfectRateAdd) +
                this.getAddCatAddtion(t, e, a.AddtionData.perfectRateAdd)
            );
        };
        t.prototype.setStarCount = function (t) {
            this.starCount = t;
        };
        t.prototype.getMaxStarCount = function (t) {
            return this.starCount[t] || 0;
        };
        t.prototype.setFoodLvToStarIndex = function (t) {
            this.foodLvToStarIndex = t;
        };
        t.prototype.getFoodLvToStarIndex = function (t, e) {
            var o = this.foodLvToStarIndex[t][e] || 0;
            return Math.max(o, 0);
        };
        t.prototype.resetInvate = function (t) {
            this.updateInvateAddTion(t, null);
        };
        t.prototype.isInvateId = function (t) {
            return this.invateIdData[t];
        };
        t.prototype.getInvateId = function () {
            return Object.keys(this.invateIdData);
        };
        t.prototype.updateInvateAddTion = function (t, e) {
            if (e) {
                this.invateIdData[t] = !0;
                var o = e.id;
                if (3 == o.length) {
                    for (var i = this.getInvateLabAllAdd(o) / 100, n = [], r = 0; r < o.length; r++) n.push(o[r].data);
                    var s = this.getCostCofItem(n);
                    s[3][a.AddtionData.allFoodAdd] += i;
                    this.invateAllCof = s;
                }
            } else {
                this.invateIdData = {};
                this.invateAllCof = {};
            }
            this.updateAllAddView();
        };
        t.prototype.getInvateLabAllAdd = function (t) {
            for (var e = 0, o = ["1", "2", "3"], a = this.getCostumeup(), i = 0; i < o.length; i++) {
                var n = t[i].data,
                    r = t[i].lv;
                if (n) {
                    var s = a[n];
                    s && (e += this.getQualityLevelAdd(s.quality, r));
                }
            }
            return e;
        };
        t.prototype.getAddMoveSpeeds = function (t, e) {
            var o = this.getAddtionValue("3", a.AddtionData.allFoodAdd);
            return (this.curAddSpeedsPro[t] && this.curAddSpeedsPro[t][e] * o) || o;
        };
        t.prototype.getAddAllAddtion = function (t) {
            return t == a.AddtionData.allFoodAdd
                ? this.getAddtionValue("3", t)
                : this.getAddtionValue("3", t) + this.getInvateAddAllAddtion(t);
        };
        t.prototype.getAddCatAddtion = function (t, e, o) {
            return this.isInvateId(t) ? this.getInvateAddCatAddtion(e, o) : this.getAddtionValue(e, o);
        };
        t.prototype.getInvateAddAllAddtion = function (t) {
            return this.getInvateAddtionValue("3", t);
        };
        t.prototype.getInvateAddCatAddtion = function (t, e) {
            return this.getInvateAddtionValue(t, e);
        };
        t.prototype.getInvateAddtionValue = function (t, e) {
            return (this.invateAllCof[t] && this.invateAllCof[t][e]) || 0;
        };
        t.prototype.getOtherMoveSpeedAdd = function (t, e) {
            return (this.curAddSpeedsPro[t] && this.curAddSpeedsPro[t][e]) || 1;
        };
        t.prototype.setAddSpeeds = function (t, e, o) {
            if (0 != o) {
                this.curAddSpeedsPro[t] || (this.curAddSpeedsPro[t] = {});
                var a = this.curAddSpeedsPro[t][e] || 1;
                this.curAddSpeedsPro[t][e] = (o / 100) * a;
                EvCat.emit(EvCat.updateCatStatus);
            }
        };
        t.prototype.getSpeedsDataSave = function () {
            return this.curAddSpeedsPro;
        };
        t.prototype.setSpeedsDataSave = function (t) {
            this.curAddSpeedsPro = t;
        };
        t.prototype.setStarItemCount = function (t) {
            this.starItemCount = t;
        };
        t.prototype.getStarItemCount = function (t, e) {
            return this.starItemCount[t][e] || 0;
        };
        t.prototype.getGetStarCountData = function (t, e) {
            var o = 0,
                a = this.foodObj[t];
            if (a) {
                var i = a;
                i[e] && (o = i[e].star);
            }
            return o;
        };
        t.prototype.getUpLevelRewardCount = function (t, e) {
            var o = "",
                a = this.foodObj[t];
            if (a) {
                var i = a;
                i[e] && (o = i[e].reward);
            }
            return o;
        };
        t.prototype.setUpLevelCostData = function (t) {
            this.foodObj = {};
            for (var e in t) {
                for (var o = [], a = t[e], i = 0; i < a.length; i++) {
                    var n = a[i],
                        r = {};
                    for (var s in n) r[s] = n[s];
                    o.push(r);
                }
                this.foodObj[e] = o;
            }
        };
        t.prototype.setFoodDevIndex = function (t) {
            this.foodDevData = t;
        };
        t.prototype.foodDevIndex = function (t, e) {
            var o = 0;
            this.foodDevData[t] && (o = this.foodDevData[t][e]);
            return o;
        };
        t.prototype.setFoodLevelData = function (t, e) {
            this.foodLevelData[t] = e;
        };
        t.prototype.updateAllAddView = function () {
            var t = this.getLabAllAdd() / 100,
                e = this.getWearData(),
                o = this.getWearTypeData(e);
            o[3][a.AddtionData.allFoodAdd] += t;
            this.allEquipAttion = o;
        };
        t.prototype.getFoodCost = function (t, e) {
            var o = this.foodObj[t],
                a = "-1";
            if (o && o[e]) {
                a = o[e].up_cost;
                for (var i = 0; i < o[e].up_cost2; i++) a += "0";
            }
            return a + "";
        };
        t.prototype.getFoodBaseCd = function (t, e) {
            var o = this.foodObj[t],
                a = -1;
            o[e] && (a = o[e].make_time - this.getAddFoodCd(t));
            return a / 1e3;
        };
        t.prototype.setFoodCdAdd = function (t, e) {
            this.foodCdData[t] = this.getAddFoodCd(t) + e;
        };
        t.prototype.getAddFoodCd = function (t) {
            return this.foodCdData[t] || 0;
        };
        t.prototype.getFoodCdSave = function () {
            return this.foodCdData;
        };
        t.prototype.setFoodCdSave = function (t) {
            this.foodCdData = t;
        };
        t.prototype.getProfit = function (t, e) {
            var o = this.foodObj[t];
            if (!o) return "0";
            var a = "-1";
            if (o[e] && "0" != (a = o[e].profit + "")) for (var i = 0; i < o[e].up_profit2; i++) a += "0";
            return a;
        };
        t.prototype.getAddtionValue = function (t, e) {
            return (this.allEquipAttion[t] && this.allEquipAttion[t][e]) || 0;
        };
        t.prototype.getMulProfit = function (t, e, o) {
            void 0 === o && (o = 1);
            var i = this.getAddAllAddtion(a.AddtionData.allFoodAdd),
                n = this.foodObj[t],
                r = "-1";
            if (n[e] && "0" != (r = n[e].profit + "")) {
                var s = Math.ceil(parseInt(r) * (1 + i));
                s *= o;
                r = Math.floor(100 * s) + "";
                for (var c = 0; c < n[e].up_profit2; c++) r += "0";
                "00" != r.slice(r.length - 2, r.length) && (r = this.addCost(r, "100"));
                r = r.slice(0, r.length - 2);
            }
            return r;
        };
        t.prototype.getProfitSaveData = function () {
            return this.foodObj;
        };
        t.prototype.setProfitSaveData = function (t) {
            this.foodObj = t;
        };
        t.prototype.copy = function (t) {
            var e = {};
            for (var o in t) e = t[o];
            return e;
        };
        t.prototype.addProfitMul = function (t, e) {
            if ("0" != t && t)
                for (var o in this.foodObj[t]) this.foodObj[t][o].profit = e * parseInt(this.foodObj[t][o].profit);
            else
                for (var a in this.foodObj)
                    for (var o in this.foodObj[a]) this.foodObj[a][o].profit = e * parseInt(this.foodObj[a][o].profit);
        };
        t.prototype.getLvUpgradeValueData = function (t) {
            var e = this.getUpgrade()[t],
                o = GameDataValue.getBuySkillLv(t + "");
            return (this.getLvData(e, o).value1 || 0) / 100;
        };
        t.prototype.getLvData = function (t, e) {
            for (var o in t) if (t[o].level == e) return t[o];
            return t[t.length - 1];
        };
        t.prototype.mulDot = function (t, e, o) {
            void 0 === o && (o = "1");
            for (var a = Math.floor(1e3 * e) + "", i = this.mulCost(t, a); "0" != i && "0" == i[0]; )
                i = i.substring(1, i.length);
            i.length >= 4 ? (i = i.substring(0, i.length - 3)) : "0" != i && (i = o);
            return i;
        };
        t.prototype.mulCost = function (t, e) {
            for (var o = "0", a = "", i = e.length - 1, n = i; n >= 0; n--) {
                a = this.getAddZero(i - n);
                var r = this.mulOnce(t, e[n]) + a;
                o = this.addCost(o, r);
            }
            return o;
        };
        t.prototype.getAddZero = function (t) {
            for (var e = "", o = 0; o < t; o++) e += "0";
            return e;
        };
        t.prototype.mulOnce = function (t, e) {
            for (var o = 0, a = "", i = 0, n = parseInt(e), r = t.length - 1; r >= 0; r--) {
                i = n * parseInt(t[r]);
                a = ((i += o) % 10) + a;
                o = Math.floor(i / 10);
            }
            o > 0 && (a = o + a);
            "" == a && (a = "0");
            return a;
        };
        t.prototype.getFoodLevel = function (t) {
            return this.foodLevelData[t] || 0;
        };
        t.prototype.getfoodName = function (t) {
            return this.allLevelData.food[t] ? this.allLevelData.food[t].name_cn : "";
        };
        t.prototype.getFoodPsId = function (t) {
            return this.allLevelData.food[t] ? this.allLevelData.food[t].ps_id : "";
        };
        t.prototype.getAllAddCost = function () {
            var t = "0";
            for (var e in this.foodLevelData)
                if (this.foodLevelData[e] > 0) {
                    var o = this.getProfit(e, this.foodLevelData[e]);
                    t = this.addCost(t, o);
                }
            return t;
        };
        t.prototype.getFoodLevelData = function () {
            return this.foodLevelData;
        };
        t.prototype.getCoinCount = function () {
            return this.curGameCount + "";
        };
        t.prototype.setCoinCount = function (t) {
            this.curGameCount = t;
            this.isUpdateRed = !0;
            this.updateDataSave();
        };
        t.prototype.updateDataSave = function () {
            this.canSave && (this.isUpdateNextSave = !0);
        };
        t.prototype.setAddEquipTip = function (t, e, o) {
            this.equipActive[t + "_" + e] = o;
        };
        t.prototype.isAddEquiptIP = function (t, e) {
            return this.equipActive[t + "_" + e];
        };
        t.prototype.setFoodTabCount = function (t, e) {
            this.foodTabCount[t] = this.getFoodTabCount(t) + e;
        };
        t.prototype.getFoodTabCount = function (t) {
            return this.foodTabCount[t] || 0;
        };
        t.prototype.resetGameTaskOverCount = function () {
            this.foodTabCount = {};
            this.invateIdData = {};
            this.foodLevelData = {};
            this.checkIdToFoodId = {};
            this.invateAllCof = {};
            this.equipActive = {};
            this.taskCost = null;
            this.allTempData = null;
            this.levelBaseData = {};
            this.flowerCatMove = null;
            this.isUpdateRed = !1;
            this.isViewAdBtn = !1;
            this.canCheckAllMinCs = !1;
            this.mapIsLoadOver = !1;
            this.isUpdateNextSave = !1;
            this.canSave = !1;
            this.taskOverIndex = {};
            this.foodCdData = {};
            this.foodTabHaveData = {};
            this.canUpLevelNextRooms = !1;
            this.curAddSpeedsPro = {};
            this.selfCatId = "";
            this.adMul = 1;
            this.devUnLockData = {};
            this.equipActive = {};
            this.redData = {};
            this.updateAllAddView();
            this.getLastAdViewGameTime(a.GameTimeKind.viewAdNextAddTime) < Date.now()
                ? (this.adMul = 1)
                : (this.adMul = 2);
        };
        t.prototype.setCheckIdToFoodIdObj = function (t) {
            this.checkIdToFoodId = t;
        };
        t.prototype.getCheckIdFood = function (t) {
            return this.checkIdToFoodId[t];
        };
        t.prototype.openRedCheck = function () {
            this.isUpdateRed = !0;
        };
        t.prototype.setRedData = function (t, e) {
            this.redData[t] = e;
        };
        t.prototype.getRedData = function (t) {
            return this.redData[t];
        };
        t.prototype.getEquipDataStatus = function (t, e) {
            return !!this.devUnLockData[t] && this.devUnLockData[t][e];
        };
        t.prototype.setEquipDataStatus = function (t, e, o) {
            this.devUnLockData[t] || (this.devUnLockData[t] = {});
            this.devUnLockData[t][e] = o;
        };
        t.prototype.getEquipDataActive = function () {
            return this.equipActive;
        };
        t.prototype.setEquipDataActive = function (t) {
            this.equipActive = t;
        };
        t.prototype.getEquipDataStatusActive = function (t, e) {
            return !!this.equipActive[t] && this.equipActive[t][e];
        };
        t.prototype.haveEquipActive = function (t) {
            var e = !1;
            for (var o in this.equipActive[t])
                if (this.equipActive[t][o]) {
                    e = !0;
                    break;
                }
            return e;
        };
        t.prototype.setEquipDataStatusActive = function (t, e, o) {
            this.equipActive[t] || (this.equipActive[t] = {});
            this.equipActive[t][e] = o;
        };
        t.prototype.setCacheCatId = function (t) {
            this.selfCatId = t;
            this.updateAllAddView();
            this.isUpdateWear = !0;
            this.checkAddNextInvate();
        };
        t.prototype.checkAddNextInvate = function () {
            var t = GameDataValue.getInvateData();
            t && this.setCurInvateData(t.data);
        };
        t.prototype.getCacheCatId = function () {
            return this.selfCatId;
        };
        t.prototype.setCanUpLevel = function (t) {
            this.canUpLevelNextRooms = t;
        };
        t.prototype.getEquipSkinData = function () {
            for (
                var t = this.getCostumeup(), e = this.getCostume(), o = ["1", "2", "3"], a = [], i = [], n = {}, r = 0;
                r < o.length;
                r++
            ) {
                var s = GameDataValue.getWearEquip(o[r]);
                if (s) {
                    var c = GameDataValue.getEquipData(s),
                        p = e[t[c.id].costume_id];
                    n[o[r]] = {x: p.postion_x, y: p.postion_y, r: p.postion_r};
                    var l = this.getEquipFrontIcon(c.id);
                    a.push(SpriteView.getSpritePath(l));
                    i.push(SpriteView.getSpritePath(this.getEquipBackIcon(c.id)));
                } else {
                    i.push("");
                    a.push("");
                }
            }
            var d = {};
            d.front = ParseTool.getEquitFrontView(a[0], a[1], a[2]);
            d.back = ParseTool.getEquitFrontView(i[0], i[1], i[2]);
            d.pos = n;
            return d;
        };
        t.prototype.getCanUpLevel = function () {
            return this.canUpLevelNextRooms;
        };
        t.prototype.setGameTaskOverCount = function (t, e) {
            this.taskOverIndex[t] = e;
            console.log("CacheDataManager ----------------- taskOverIndex setGameTaskOverCount");
            this.updateDataSave();
        };
        t.prototype.getTaskSaveData = function () {
            return this.taskOverIndex;
        };
        t.prototype.getGameTaskCount = function (t) {
            return !this.taskOverIndex[t];
        };
        t.prototype.logTask = function () {
            console.log("CacheDataManager -----------------  this.taskOverIndex", this.taskOverIndex);
        };
        t.prototype.addGameC = function (t) {
            this.setCoinCount(this.addCost(t + "", this.getCoinCount()));
            this.updateCostDataView = !0;
        };
        t.prototype.getCoinStr = function () {
            return ParseTool.parseAbc(this.getCoinCount());
        };
        t.prototype.checkCost = function (t, e) {
            if (t == e) return !0;
            if ("-" == e[0] && "-" != t[0]) return !0;
            if ("-" == t[0] && "-" != e[0]) return !1;
            if ("-" == e[0] && "-" == t[0]) return !this.checkCost(t.substring(1, t.length), e.substring(1, e.length));
            if (t.length > e.length) return !0;
            if (t.length < e.length) return !1;
            for (var o = !0, a = t.length, i = 0; i < a; i++)
                if (t[i] != e[i]) {
                    o = parseInt(t[i]) >= parseInt(e[i]);
                    break;
                }
            return o;
        };
        t.prototype.addCost = function (t, e) {
            if ("-" == t[0] && "-" != e[0]) return this.reduceCost(e, t.substring(1, t.length));
            if ("-" == e[0] && "-" != t[0]) return this.reduceCost(t, e.substring(1, e.length));
            if ("-" == t[0] && "-" == e[0]) return this.reduceCost(t, e.substring(1, e.length));
            for (var o = t.length - 1, a = e.length - 1, i = Math.max(o, a), n = 0, r = ""; i >= 0; ) {
                i--;
                if (o >= 0 && a >= 0) {
                    var s = this.objRule[t[o] + e[a]];
                    r = (c = this.objRule[s.a + "" + n]).a + r;
                    n = s.n + c.n;
                    o--;
                    a--;
                } else {
                    if (o >= 0) {
                        r = (c = this.objRule[t[o] + "" + n]).a + r;
                        n = c.n;
                        o--;
                    }
                    if (a >= 0) {
                        var c;
                        r = (c = this.objRule[e[a] + "" + n]).a + r;
                        n = c.n;
                        a--;
                    }
                }
            }
            n > 0 && (r = n + r);
            return r;
        };
        t.prototype.setRule = function (t) {
            this.objRule = t;
        };
        t.prototype.reduceCost = function (t, e) {
            if (t == e) return "0";
            if ("-" == t[0] && "-" != e[0]) return "-" + this.addCost(t.substring(1, t.length), e);
            if ("-" == e[0] && "-" != t[0]) return this.addCost(e.substring(1, e.length), t);
            if ("-" == t[0] && "-" == e[0]) return this.addCost(e.substring(1, e.length), t);
            var o = t.length - 1,
                a = e.length - 1,
                i = "",
                n = 0,
                r = Math.max(o, a),
                s = "";
            if (this.checkCost(e, t)) {
                var c = a;
                a = o;
                o = c;
                var p = t;
                t = e;
                e = p;
                s = "-";
            }
            for (; r >= 0; ) {
                r--;
                if (o >= 0 && a >= 0) {
                    var l = this.objRule[t[o] + n];
                    if ((l.m > 0 && o <= 0) || (o <= 0 && this.objRule[e[a] + "0"].r > l.r)) {
                        var d = this.objRule[e[a] + l.r];
                        i = d.r + i;
                        n = d.m + l.m;
                        s = "-";
                    } else {
                        i = (u = this.objRule[l.r + e[a]]).r + i;
                        n = u.m + l.m;
                    }
                    o--;
                    a--;
                } else {
                    if (o >= 0) {
                        i = (u = this.objRule[t[o] + n]).r + i;
                        n = u.m;
                        o--;
                    }
                    if (a >= 0) {
                        s = "-";
                        var u;
                        i = (u = this.objRule[e[a] + n]).r + i;
                        n = u.m;
                        a--;
                    }
                }
            }
            for (var h = 0, f = 0; f < i.length; f++) {
                "0" == i[f] && h++;
                if ("0" != i[f]) break;
            }
            if (0 == (i = i.substring(h, i.length)).length) {
                i = "0";
                s = "";
            }
            return s + i;
        };
        t.prototype.canUpLevel = function (t) {
            var e = this.getCoinCount(),
                o = this.getFoodLevel(t),
                a = this.getFoodCost(t, o);
            return "-1" != a && this.checkCost(e, a);
        };
        t.prototype.setLevelRoomData = function (t) {
            this.allLevelData = t;
        };
        t.prototype.getTempFood = function () {
            if (!this.allTempData) {
                var t = {},
                    e = this.allLevelData.levelfood;
                for (var o in e) {
                    var a = e[o].work_id;
                    t[a] || (t[a] = []);
                    t[a].push(this.getGetCopy(e[o]));
                }
                this.allTempData = t;
            }
            return this.allTempData;
        };
        t.prototype.getGetCopy = function (t) {
            var e = {};
            for (var o in t) e[o] = t[o];
            return e;
        };
        t.prototype.getChapterRoomId = function (t) {
            var e = 8001 + Math.floor(t / 7) + "",
                o = "restaurant_id" + ((t % 7) + 1);
            return this.allLevelData && this.allLevelData.chapter && this.allLevelData.chapter[e]
                ? this.allLevelData.chapter[e][o]
                : null;
        };
        t.prototype.getLevelChapterMul = function (t) {
            var e = 8001 + Math.floor(t / 7) + "";
            return (
                (this.allLevelData &&
                    this.allLevelData.chapter &&
                    this.allLevelData.chapter[e] &&
                    this.allLevelData.chapter[e].update_rate) ||
                1
            );
        };
        t.prototype.getChapter = function (t) {
            return this.allLevelData.chapter[t];
        };
        t.prototype.getLevelChapter = function (t) {
            if (this.levelBaseData[t]) return this.levelBaseData[t];
            var e = 8001 + Math.floor(t / 7) + "",
                o = (t % 7) + 1,
                a = "restaurant_id" + o;
            if (this.allLevelData && this.allLevelData.chapter && this.allLevelData.chapter[e]) {
                for (
                    var i = this.allLevelData.chapter[e],
                        n = i.update_rate,
                        r = i[a],
                        s = "600" + o,
                        c = this.allLevelData.restaurant[r].food + "",
                        p = this.allLevelData.restaurant[s].food + "",
                        l = c.split("|"),
                        d = p.split("|"),
                        u = this.getTempFood(),
                        h = {},
                        f = 0;
                    f < l.length && f < d.length;
                    f++
                ) {
                    var y = d[f],
                        v = l[f],
                        g = y;
                    h[f] = u[g];
                    h[f].key = v;
                }
                var m = {mul: n, obj: (h = this.getMul(h, n))};
                this.levelBaseData[t] = m;
            }
            return this.levelBaseData[t];
        };
        t.prototype.getMul = function (t, e) {
            for (var o in t)
                if (t[o])
                    for (var a in t[o])
                        if (t[o][a].up_cost > 0) {
                            var i = Math.floor(t[o][a].up_cost * e);
                            t[o][a].up_cost2 = this.getLvCost(i, t[o][a].up_cost2);
                            t[o][a].up_cost = this.getLvValue(i);
                        }
            return t;
        };
        t.prototype.getLvCost = function (t, e) {
            return t % 10 == 0 && 0 != t ? this.getLvCost(t / 10, e + 1) : e;
        };
        t.prototype.getLvValue = function (t) {
            return t % 10 == 0 && 0 != t ? this.getLvValue(t / 10) : t;
        };
        t.prototype.getLevelRoomData = function (t) {
            var e = {},
                o = this.allLevelData.levelfood;
            for (var a in o)
                if (o[a].restaurant + "" == t) {
                    e[t] || (e[t] = []);
                    e[t].push(o[a]);
                }
            return e;
        };
        t.prototype.getEmployee = function () {
            return this.allLevelData.employee;
        };
        t.prototype.getShopData = function () {
            return this.getShopDataCof().shop;
        };
        t.prototype.getUpgrade = function () {
            if (null == this.cacheUpgrade) {
                var t = {},
                    e = this.allLevelData.upgrade;
                for (var o in e) {
                    var a = e[o].upgrade_type;
                    t[a] || (t[a] = []);
                    t[a].push(e[o]);
                }
                this.cacheUpgrade = t;
            }
            return this.cacheUpgrade;
        };
        t.prototype.getCustomer = function () {
            return this.allLevelData.customer;
        };
        t.prototype.getCostume = function () {
            return this.allLevelData.costume;
        };
        t.prototype.getCostumeup = function () {
            return this.allLevelData.costume_up;
        };
        t.prototype.getTypeEquip = function (t) {
            var e = GameDataValue.getAllSelfEquip(),
                o = this.getCostumeup(),
                a = this.getCostume(),
                i = [];
            for (var n in e) {
                var r = e[n].id;
                o && o[r] && a[o[r].costume_id].type == t && i.push(e[n]);
            }
            return i;
        };
        t.prototype.getLabAllAdd = function () {
            for (
                var t = 0, e = ["1", "2", "3"], o = this.getCostumeup(), a = (this.getCostume(), 0);
                a < e.length;
                a++
            ) {
                var i = GameDataValue.getWearEquip(e[a]);
                if (i) {
                    var n = GameDataValue.getEquipData(i),
                        r = o[n.id];
                    r && (t += this.getQualityLevelAdd(r.quality, n.lv));
                }
            }
            return t;
        };
        t.prototype.getWearData = function () {
            for (var t = ["1", "2", "3"], e = [], o = 0; o < t.length; o++) {
                var a = GameDataValue.getWearEquip(t[o]);
                if (a) {
                    var i = GameDataValue.getEquipData(a);
                    e.push(i);
                }
            }
            return e;
        };
        t.prototype.getWearTypeData = function (t) {
            for (var e = [], o = 0; o < t.length; o++) e.push(t[o].id);
            return this.getCostCofItem(e);
        };
        t.prototype.getCostCofItem = function (t) {
            for (var e = {}, o = 0; o < 4; o++) e[o] = {};
            for (o = 0; o < 9; o++)
                for (var a = o + 1 + "", i = 0; i < 4; i++) {
                    e[i][a] = 0;
                    e[i][a] = 0;
                }
            var n = this.getCostumeup(),
                r = this.getCostume();
            for (o = 0; o < t.length; o++) {
                var s = n[t[o]],
                    c = r[s.costume_id];
                if (c)
                    for (var p = 0; p < 4; p++) {
                        var l = "value" + (p + 1);
                        if (c["unlock" + (p + 1)] <= s.quality) {
                            var d = (c[l] + "").split("_");
                            3 == d.length && (e[d[1]][d[0]] += parseInt(d[2]) / 100);
                        }
                    }
            }
            return e;
        };
        t.prototype.getLang = function (t) {
            var e = this.allLevelData.txt;
            return e && e[t] ? e[t].cn : "";
        };
        t.prototype.getQualityLevelIndexAdd = function (t, e) {
            var o = this.getCostumeLvData(t, e);
            return o ? o.value1 : 0;
        };
        t.prototype.getQualityLevelAdd = function (t, e) {
            var o = t + "_" + e;
            if (!this.objTypeLevelAddData[o]) {
                var a = this.allLevelData.costume_lv,
                    i = 0;
                for (var n in a) a[n].quality == t && a[n].name <= e && (isNaN(a[n].value1) || (i += a[n].value1));
                this.objTypeLevelAddData[o] = i;
            }
            return this.objTypeLevelAddData[o] || 0;
        };
        t.prototype.getQualityMaxLv = function (t) {
            var e = this.allLevelData.costume_lv,
                o = 1;
            for (var a in e) e[a].quality == t && (isNaN(e[a].name) || (o = Math.max(o, e[a].name)));
            return o;
        };
        t.prototype.getCostumeLvData = function (t, e) {
            var o = this.allLevelData.costume_lv;
            for (var a in o) if (o[a].quality == t && o[a].name == e) return o[a];
            return null;
        };
        t.prototype.getLevelupgrade = function (t, e) {
            var o = t + "_" + e;
            this.levelUpgradeData[o] || (this.levelUpgradeData[o] = this.levelUpgrade(t, e));
            return this.levelUpgradeData[o];
        };
        t.prototype.geTaskCost = function () {
            if (!this.taskCost) {
                var t = GameDataValue.getLastLv(),
                    e = this.getChapterRoomId(t),
                    o = this.getLevelupgrade(e, t);
                this.taskCost = o;
            }
            return this.taskCost;
        };
        t.prototype.haveCanUpLevelSkill = function () {
            var t = this.geTaskCost(),
                e = this.getCoinCount();
            if (t)
                for (var o in t) {
                    var a = t[o];
                    if (this.getGameTaskCount(o)) {
                        var i = ParseTool.getListCost(a.up_cost, a.up_cost2);
                        if (this.checkCost(e, i)) return !0;
                    }
                }
            return !1;
        };
        t.prototype.levelUpgrade = function (t, e) {
            var o = {},
                a = this.getRestaurant(t, e),
                i = this.getLevelChapterMul(e),
                n = this.allLevelData.levelupgrade,
                r = a.restaurant_up_id + "";
            for (var s in n)
                if (n[s].restaurant + "" == r) {
                    o[t] || (o[t] = []);
                    o[t].push(n[s]);
                }
            return (o = this.getMul(o, i))[t];
        };
        t.prototype.getRestaurant = function (t, e) {
            var o = t + "_" + e;
            if (!this.roomRestaurant[o]) {
                var a = {},
                    i = this.allLevelData.restaurant;
                for (var n in i)
                    if (t == n) {
                        var r = i[n];
                        for (var s in r) a[s] = r[s];
                    }
                var c = this.getLevelChapterMul(e),
                    p = Math.floor(a.up_cost * c);
                a.up_cost2 = this.getLvCost(p, a.up_cost2);
                a.up_cost = this.getLvValue(p);
                a.ini_coin = Math.floor(a.ini_coin * c);
                this.roomRestaurant[o] = a;
            }
            return this.roomRestaurant[o];
        };
        t.prototype.getRestaurantBaseData = function () {
            return this.allLevelData.restaurant;
        };
        t.prototype.getRewardKind = function (t) {
            return this.allLevelData && null != this.allLevelData.item ? this.allLevelData.item[t] : "";
        };
        t.prototype.getIcon = function () {
            return this.allLevelData.icon;
        };
        t.prototype.getNpcLevelAren = function (t) {
            return this.levelNpcMoveAren[t % 7];
        };
        t.prototype.getRoadLevelAren = function (t) {
            return this.levelRoadMoveAren[t % 7];
        };
        t.prototype.setNpcLevelAren = function (t, e) {
            this.levelNpcMoveAren = t;
            this.levelRoadMoveAren = e;
        };
        t.prototype.setLevelRoadPath = function (t, e) {
            this.levelRoadPath[t] = e;
        };
        t.prototype.getLevelRoadPath = function (t) {
            var e = parseInt(t.slice(5, t.length)) - 1;
            return this.levelRoadPath[e];
        };
        t.prototype.getEquipName = function (t) {
            var e = this.getCostumeup();
            if (e[t]) return this.getEquipCostumeUpName(e[t]);
        };
        t.prototype.getEquipCostumeUpName = function (t) {
            var e = this.getCostume()[t.costume_id];
            if (e) return t.quality >= this.qualityCenterChange ? this.getLang(e.name_4) : this.getLang(e.name);
        };
        t.prototype.getEquipBaseIcon = function (t) {
            var e = this.getCostumeup();
            if (e[t]) return this.getEquipCostumeUpToIcon(e[t]);
        };
        t.prototype.getEquipCostumeUpToIcon = function (t) {
            var e = this.getCostume()[t.costume_id];
            if (e) return t.quality >= this.qualityCenterChange ? e.icon_4 : e.icon;
        };
        t.prototype.getEquipBackIcon = function (t) {
            var e = this.getCostumeup();
            if (e[t]) {
                var o = this.getCostume()[e[t].costume_id];
                if (o) return e[t].quality >= this.qualityCenterChange ? o.wear_icon_back_4 : o.wear_icon_back;
            }
        };
        t.prototype.getEquipFrontIcon = function (t) {
            var e = this.getCostumeup();
            if (e[t]) {
                var o = this.getCostume()[e[t].costume_id];
                if (o) return e[t].quality >= this.qualityCenterChange ? o.wear_icon_front_4 : o.wear_icon_front;
            }
        };
        t.prototype.init = function () {};
        t.prototype.addRandListIndex = function (t, e, o) {
            if (e < t.length) {
                t.push(o);
                for (var a = t.length - 1; a - 1 >= e; a--) t[a] = t[a - 1];
                t[e] = o;
            }
            return t;
        };
        t.prototype.timeLimite = function (t) {
            var e = (this.timeObj[t] || 0) < Date.now();
            e && (this.timeObj[t] = Date.now() + 100);
            return e;
        };
        t.prototype.setCurInvateData = function (t) {
            this.invateData = t;
            GameDataValue.setInvateData(t, Date.now());
            TaskGameEvent.emit(TaskGameEvent.addNewTempNPC, t);
        };
        t.prototype.getLastInvateDataList = function () {
            var t = GameDataValue.getTempInvate();
            if (!t) {
                t = this.getNewInvateList();
                GameDataValue.addTempInvate(t);
            }
            return t;
        };
        t.prototype.getNewInvateList = function () {
            var t = [],
                e = this.getCostumeup(),
                o = this.getCostume(),
                a = {};
            for (var i in e) {
                var n = e[i].quality;
                a[n] || (a[n] = {});
                var r = o[e[i].costume_id].type;
                a[n][r] || (a[n][r] = []);
                a[n][r].push(i);
            }
            t = this.getInvateData(1, -1, 4, a, t);
            t = this.getInvateData(1, -1, 3, a, t);
            return this.getInvateData(3, -3, 1, a, t);
        };
        t.prototype.getInvateData = function (t, e, o, a, i) {
            for (var n = 0; n < t; n++) {
                for (var r = this.getOnceInvateQualityData(e, o), s = [], c = 0; c < r.length; c++) {
                    var p = c + 1,
                        l = a[r[c]][p].length,
                        d = Math.floor(Math.random() * l),
                        u = a[r[c]][p][d];
                    s.push({data: u, lv: 1 + Math.floor(5 * Math.random())});
                }
                i.push(s);
            }
            return i;
        };
        t.prototype.getRandMostUp = function (t) {
            var e = [],
                o = this.getCostumeup();
            for (var a in o) o[a].quality + "" == t && e.push(a);
            if (e.length > 0) return e[Math.floor(Math.random() * e.length)];
        };
        t.prototype.getOnceInvateQualityData = function (t, e) {
            for (var o = [], a = ["1", "2", "3"], i = this.getCostumeup(), n = 0; n < a.length; n++) {
                var r = GameDataValue.getWearEquip(a[n]),
                    s = Math.max(1, Math.min(e, 11));
                if (r) {
                    var c = GameDataValue.getEquipData(r);
                    s = Math.floor(Math.random() * (e - t)) + t + i[c.id].quality;
                    s = Math.max(1, Math.min(s, 11));
                }
                o.push(s);
            }
            return o;
        };
        return t;
    })())();
window.CacheDataManager = i;
o.default = i;
